<?php

namespace App\Controllers\Image;
//require __DIR__ . '/../../libs\thirdparty/QrCode/src/QrCode.php';
use \Endroid\QrCode\QrCode;
use \Endroid\QrCode\Writer\PngWriter;
class Qrcode_gen extends \App\Libs\Base\BaseAction
{
    public function execute() {
        $text = $this->request->get('text');
        //var_dump($text);
        //$text = urlencode($text);
        //var_dump($text);exit;
        //$text = str_replace('+', '%2B', $text);
        $qrcode = new QrCode();
        $qrcode->setText($text)->setSize(275);
		header('Content-Type: '.$qrcode->getContentType(PngWriter::class));
		echo $qrcode->writeString(PngWriter::class);

    	exit;


    }
}

